// pages/home/home.js
var time = require('../../utils/util.js');
var Charts = require('../../utils/wxcharts.js');
Page({
  /**
   * 页面的初始数据
   */
  data: {
    customcache: false,
    hidfold1: false,
    hidfold2: true,
    hidfold3: true,
    isfollow: false,
    islike: false,
    istake: true,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.ZXT();
  },  

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },
  
  ZXT:function(){
    // new Charts({
    //   canvasId: 'lineCanvas',
    //   type: 'line',
    //   categories: ['2012', '2013', '2014', '2015', '2016', '2017'],
    //   series: [{
    //     name: '成交量1',
    //     data: [0.15, 0.2, 0.45, 0.37, 0.4, 0.8],
    //     format: function (val) {
    //       return val.toFixed(2) + '万';
    //     }
    //   }, {
    //     name: '成交量2',
    //     data: [0.30, 0.37, 0.65, 0.78, 0.69, 0.94],
    //     format: function (val) {
    //       return val.toFixed(2) + '万';
    //     }
    //   }],
    //   yAxis: {
    //     title: '成交金额 (万元)',
    //     format: function (val) {
    //       return val.toFixed(2);
    //     },
    //     min: 0
    //   },
    //   width: 217,
    //   height: 168,
    // });
    new Charts({
      canvasId: 'lineCanvas',
      type: 'area',
      categories: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
      series: [{
        name: '成交量',
        data: [50, 55, 49, 51, 50, 48, 46, 47, 45, 42, 44],
        color: '#418fde',
        // format: function (val) {
        //   return val.toFixed(2) + '万';
        // }
      }],
      yAxis: {
        // format: function (val) {
        //   return val + '万';
        // }
      },
      width: 217,
      height: 168
    });
    new Charts({
      canvasId: 'lineCanvas2',
      type: 'area',
      categories: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
      series: [{
        name: '成交量',
        data: [50, 55, 49, 51, 50, 48, 46, 47, 45, 42, 44],
        color: '#418fde',
        // format: function (val) {
        //   return val.toFixed(2) + '万';
        // }
      }],
      yAxis: {
        // format: function (val) {
        //   return val + '万';
        // }
      },
      width: 217,
      height: 168
    });
    new Charts({
      canvasId: 'lineCanvas3',
      type: 'area',
      categories: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
      series: [{
        name: '成交量',
        data: [50, 55, 49, 51, 50, 48, 46, 47, 45, 42, 44],
        color: '#418fde',
        // format: function (val) {
        //   return val.toFixed(2) + '万';
        // }
      }],
      yAxis: {
        // format: function (val) {
        //   return val + '万';
        // }
      },
      width: 217,
      height: 168
    });
    new Charts({
      canvasId: 'lineCanvas4',
      type: 'area',
      categories: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
      series: [{
        name: '成交量',
        data: [50, 55, 49, 51, 50, 48, 46, 47, 45, 42, 44],
        color: '#418fde',
        // format: function (val) {
        //   return val.toFixed(2) + '万';
        // }
      }],
      yAxis: {
        // format: function (val) {
        //   return val + '万';
        // }
      },
      width: 217,
      height: 168
    });
  },

  goNews:function(){
    wx.navigateTo({
      url: '../xwxq/xwxq',
    })
  },

  goXWDT:function(e){
    var paper = e.currentTarget.id;
    wx.navigateTo({
      url: '../xwdt/xwdt?paper=' + paper,
    })
  },

  goGYWM:function(){
    wx.navigateTo({
      url: '../gywm/gywm',
    })
  },

  goYXCL:function(){
    wx.switchTab({
      url: '../strategy/strategy',
    })
  },

  goJYZJ:function(){
    wx.switchTab({
      url: '../document/document',
    })
  },

  hidfold:function(e){
    var id = e.currentTarget.id;
    var that = this;
    switch (id) {
      case '1':
        that.setData({
          hidfold1: !that.data.hidfold1
        });
        break;
      case '2':
        that.setData({
          hidfold2: !that.data.hidfold2
        });
        break;
      case '3':
        that.setData({
          hidfold3: !that.data.hidfold3
        });
        break;
    }
  },

  follow:function(){
    var that = this;
    that.setData({
      isfollow: !that.data.isfollow
    })
  },

  like:function(){
    var that = this;
    that.setData({
      islike: !that.data.islike
    })
  },

  take:function(){
    var that = this;
    that.setData({
      istake: !that.data.istake
    })
  },

})